#include <iostream>
#include <queue>
#include <string>
#include <string.h>
using namespace std;


string aim="yizhong";


bool dfs(int x,int y,int n,int index,char *a,bool *vis,int dir){
	if(index >= aim.length())
		return true;
	if(x < 0  ||  x >= n  ||  y < 0  ||  y >= n)
		return false;
	if(index == 0){
		bool is=false;
		is = dfs(x-1,y,n,index+1,a,vis,0)||is;
		is = dfs(x-1,y-1,n,index+1,a,vis,1)||is;
		is = dfs(x,y-1,n,index+1,a,vis,2)||is;
		is = dfs(x+1,y-1,n,index+1,a,vis,3)||is;
		is = dfs(x+1,y,n,index+1,a,vis,4)||is;
		is = dfs(x+1,y+1,n,index+1,a,vis,5)||is;
		is = dfs(x,y+1,n,index+1,a,vis,6)||is;
		is = dfs(x-1,y+1,n,index+1,a,vis,7)||is;
		if(is){
			vis[y*n+x] = true;
			return true;
		}
	}
	else{
		if(dir == 0){
			if(a[y*n+x] == aim[index]){
				if(dfs(x-1,y,n,index+1,a,vis,dir)){
					vis[y*n+x] = true;
					return true;
				}
			}
			return false;
		}
		else if(dir == 1){
			if(a[y*n+x] == aim[index]){
				if(dfs(x-1,y-1,n,index+1,a,vis,dir)){
					vis[y*n+x] = true;
					return true;
				}
			}
			return false;
		}
		else if(dir == 2){
			if(a[y*n+x] == aim[index]){
				if(dfs(x,y-1,n,index+1,a,vis,dir)){
					vis[y*n+x] = true;
					return true;
				}
			}
			return false;
		}
		else if(dir == 3){
			if(a[y*n+x] == aim[index]){
				if(dfs(x+1,y-1,n,index+1,a,vis,dir)){
					vis[y*n+x] = true;
					return true;
				}
			}
			return false;
		}
		else if(dir == 4){
			if(a[y*n+x] == aim[index]){
				if(dfs(x+1,y,n,index+1,a,vis,dir)){
					vis[y*n+x] = true;
					return true;
				}
			}
			return false;
		}
		else if(dir == 5){
			if(a[y*n+x] == aim[index]){
				if(dfs(x+1,y+1,n,index+1,a,vis,dir)){
					vis[y*n+x] = true;
					return true;
				}
			}
			return false;
		}
		else if(dir == 6){
			if(a[y*n+x] == aim[index]){
				if(dfs(x,y+1,n,index+1,a,vis,dir)){
					vis[y*n+x] = true;
					return true;
				}
			}
			return false;
		}
		else if(dir == 7){
			if(a[y*n+x] == aim[index]){
				if(dfs(x-1,y+1,n,index+1,a,vis,dir)){
					vis[y*n+x] = true;
					return true;
				}
			}
			return false;
		}
	}
}


int main(){
	int n;
	cin>>n;
	char a[n][n];
	bool vis[n][n];
	memset(vis,false,sizeof(vis));
	queue<int> q;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			cin>>a[i][j];
			if(a[i][j] == aim[0]){
				q.push(i);
				q.push(j);
			}
		}
	}
	
	while(!q.empty()){
		int x,y;
		y = q.front();
		q.pop();
		x = q.front();
		q.pop();
		dfs(x,y,n,0,&a[0][0],&vis[0][0],-1);
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(vis[i][j] == false)
				cout<<"*";
			else
				cout<<a[i][j];
		}
		cout<<endl;
	}
	return 0;
}
